#pragma once
#include "IStringTab.h"

class StringTabNode
{
    char* data;
    StringTabNode* next;

public:
    static const size_t INIT_SIZE;
    
    StringTabNode();
    ~StringTabNode();

    char* getData();
    void setNext(StringTabNode* next);
};

class StringTabV0 : public IStringTab
{
    StringTabNode* firstNode;
    StringTabNode* currentNode;
    char* head;
    char* tail;
    size_t free;
    size_t len;

private:    
    void realloc();
    void rollback();

public:
    StringTabV0();
    ~StringTabV0();

    //inheritance from IStringTab
    virtual void putChar(char c);
    virtual Lexem mkLexem();
    //from clgr
    virtual int  unputCharsAndGetAsInt();
    virtual char unputAndGetChar();
};

